package com.yzk.auction.service;

import com.yzk.auction.dao.OrderDao;
import com.yzk.auction.entity.OrderAll;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;


public class OrderSerivce {

    public static long ordersCount() {
        return OrderDao.ordersCount();
    }

    public static List<OrderAll> listOrder() {
        List<OrderAll> list = null;
        list = OrderDao.query();
        return list;
    }

    public static int odelete(String order_id) {
        int i = 0;
        i = OrderDao.sql_update("DELETE FROM tb_orders WHERE order_id=" + order_id + ";");
        return i;
    }

    public static int oupdate(String user_name, String user_addr) {
        int i = 0;
        i = OrderDao.sql_update("Update tb_users set user_addr='" + user_addr + "' where user_name='" + user_name + "';");
        return i;
    }

    public static void insertOrsers(int goods_id, int user_id, Date order_time, int pay_status) throws SQLException {
        OrderDao.insertOrsers(goods_id, user_id, order_time, pay_status);
    }

    public static void updateOrsers(int goods_id, int user_id, Date order_time, int pay_status) throws SQLException {
        OrderDao.updateOrsers(goods_id,user_id,order_time,pay_status);
    }

}


